.class public final Lnbisdk/hp;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/location/LocationListener;
.implements Lnbisdk/gn;


# instance fields
.field private ca:Lcom/nbi/common/NBIContext;

.field private ck:Landroid/location/LocationManager;

.field private el:Lcom/nbi/location/LocationListener;


# direct methods
.method public constructor <init>(Lcom/nbi/common/NBIContext;Lcom/nbi/location/LocationListener;)V
    .locals 1

    const/4 v0, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    iput-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    iput-object v0, p0, Lnbisdk/hp;->ca:Lcom/nbi/common/NBIContext;

    if-eqz p2, :cond_0

    if-nez p1, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    iput-object p1, p0, Lnbisdk/hp;->ca:Lcom/nbi/common/NBIContext;

    iput-object p2, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    invoke-direct {p0}, Lnbisdk/hp;->aU()Z

    goto :goto_0
.end method

.method private aU()Z
    .locals 4

    const/16 v3, 0x2349

    const/4 v2, 0x0

    iget-object v0, p0, Lnbisdk/hp;->ca:Lcom/nbi/common/NBIContext;

    invoke-virtual {v0}, Lcom/nbi/common/NBIContext;->getInternalObject()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lnbisdk/bl;

    if-nez v0, :cond_0

    move v0, v2

    :goto_0
    return v0

    :cond_0
    invoke-virtual {v0}, Lnbisdk/bl;->jw()Landroid/content/Context;

    move-result-object v0

    const-string v1, "location"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/location/LocationManager;

    iput-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    iget-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    const-string v1, "gps"

    invoke-virtual {v0, v1}, Landroid/location/LocationManager;->isProviderEnabled(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_3

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    if-eqz v0, :cond_3

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    invoke-interface {v0, v3}, Lcom/nbi/location/LocationListener;->onLocationError(I)V

    move v0, v2

    goto :goto_0

    :cond_1
    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    if-eqz v0, :cond_2

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    invoke-interface {v0, v3}, Lcom/nbi/location/LocationListener;->onLocationError(I)V

    move v0, v2

    goto :goto_0

    :cond_2
    move v0, v2

    goto :goto_0

    :cond_3
    const/4 v0, 0x1

    goto :goto_0
.end method


# virtual methods
.method public final bj()Z
    .locals 2

    const/4 v1, 0x0

    iput-object v1, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    iget-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    invoke-virtual {v0, p0}, Landroid/location/LocationManager;->removeUpdates(Landroid/location/LocationListener;)V

    sget-boolean v0, Lnbisdk/bk;->cG:Z

    if-eqz v0, :cond_0

    invoke-static {}, Lnbisdk/cq;->dZ()V

    :cond_0
    iput-object v1, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public final bl()Z
    .locals 7

    const/4 v6, 0x0

    iget-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    if-nez v0, :cond_1

    :cond_0
    move v0, v6

    :goto_0
    return v0

    :cond_1
    :try_start_0
    iget-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    const-string v1, "gps"

    invoke-virtual {v0, v1}, Landroid/location/LocationManager;->isProviderEnabled(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_2

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    const/16 v1, 0x2349

    invoke-interface {v0, v1}, Lcom/nbi/location/LocationListener;->onLocationError(I)V

    move v0, v6

    goto :goto_0

    :cond_2
    iget-object v0, p0, Lnbisdk/hp;->ck:Landroid/location/LocationManager;

    const-string v1, "gps"

    const-wide/16 v2, 0x3e8

    const/4 v4, 0x0

    move-object v5, p0

    invoke-virtual/range {v0 .. v5}, Landroid/location/LocationManager;->requestLocationUpdates(Ljava/lang/String;JFLandroid/location/LocationListener;)V

    sget-boolean v0, Lnbisdk/bk;->cG:Z

    if-eqz v0, :cond_3

    invoke-static {}, Lnbisdk/cq;->dY()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_3
    const/4 v0, 0x1

    goto :goto_0

    :catch_0
    move-exception v0

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    if-eqz v0, :cond_4

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    const/16 v1, 0x2329

    invoke-interface {v0, v1}, Lcom/nbi/location/LocationListener;->onLocationError(I)V

    :cond_4
    move v0, v6

    goto :goto_0
.end method

.method public final onLocationChanged(Landroid/location/Location;)V
    .locals 14

    const-wide/16 v12, 0x3e8

    const-wide/16 v10, 0x0

    const/4 v9, 0x1

    const/4 v8, 0x0

    const-wide/16 v6, 0x0

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    if-eqz v0, :cond_0

    if-nez p1, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    new-instance v0, Lcom/nbi/location/Location;

    invoke-direct {v0}, Lcom/nbi/location/Location;-><init>()V

    if-eqz p1, :cond_2

    if-nez v0, :cond_4

    :cond_2
    :goto_1
    iget-object v1, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    invoke-interface {v1, v0}, Lcom/nbi/location/LocationListener;->locationUpdated(Lcom/nbi/location/Location;)V

    new-instance v0, Lnbisdk/ra;

    invoke-direct {v0}, Lnbisdk/ra;-><init>()V

    invoke-virtual {v0}, Lnbisdk/ra;->clear()V

    if-nez p1, :cond_b

    move v1, v8

    :goto_2
    if-ne v1, v9, :cond_3

    if-eqz p1, :cond_3

    if-nez v0, :cond_e

    :cond_3
    :goto_3
    sget-boolean v1, Lnbisdk/bk;->cG:Z

    if-eqz v1, :cond_0

    invoke-static {v0}, Lnbisdk/cq;->b(Lnbisdk/kw;)V

    goto :goto_0

    :cond_4
    invoke-virtual {p1}, Landroid/location/Location;->getLatitude()D

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Lcom/nbi/location/Location;->setLatitude(D)V

    invoke-virtual {p1}, Landroid/location/Location;->getLongitude()D

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Lcom/nbi/location/Location;->setLongitude(D)V

    const/4 v1, 0x3

    invoke-virtual {p1}, Landroid/location/Location;->hasAccuracy()Z

    move-result v2

    if-eqz v2, :cond_5

    invoke-virtual {p1}, Landroid/location/Location;->getAccuracy()F

    move-result v1

    float-to-int v1, v1

    invoke-virtual {v0, v1}, Lcom/nbi/location/Location;->setAccuracy(I)V

    const/16 v1, 0x83

    :cond_5
    invoke-virtual {p1}, Landroid/location/Location;->hasAltitude()Z

    move-result v2

    if-eqz v2, :cond_6

    invoke-virtual {p1}, Landroid/location/Location;->getAltitude()D

    move-result-wide v2

    double-to-int v2, v2

    int-to-double v2, v2

    invoke-virtual {v0, v2, v3}, Lcom/nbi/location/Location;->setAltitude(D)V

    or-int/lit8 v1, v1, 0x4

    :cond_6
    invoke-virtual {p1}, Landroid/location/Location;->hasBearing()Z

    move-result v2

    if-eqz v2, :cond_7

    invoke-virtual {p1}, Landroid/location/Location;->getBearing()F

    move-result v2

    float-to-int v2, v2

    int-to-double v2, v2

    invoke-virtual {v0, v2, v3}, Lcom/nbi/location/Location;->setHeading(D)V

    or-int/lit8 v1, v1, 0x8

    :cond_7
    invoke-virtual {p1}, Landroid/location/Location;->hasSpeed()Z

    move-result v2

    if-eqz v2, :cond_8

    invoke-virtual {p1}, Landroid/location/Location;->getSpeed()F

    move-result v2

    float-to-double v2, v2

    invoke-virtual {v0, v2, v3}, Lcom/nbi/location/Location;->setHorizontalVelocity(D)V

    or-int/lit8 v1, v1, 0x10

    :cond_8
    invoke-virtual {p1}, Landroid/location/Location;->getTime()J

    move-result-wide v2

    cmp-long v2, v2, v10

    if-lez v2, :cond_9

    invoke-virtual {p1}, Landroid/location/Location;->getTime()J

    move-result-wide v2

    div-long/2addr v2, v12

    const-wide/32 v4, 0x12d53d80

    sub-long/2addr v2, v4

    invoke-virtual {v0, v2, v3}, Lcom/nbi/location/Location;->setGpsTime(J)V

    or-int/lit8 v1, v1, 0x20

    :cond_9
    iget-object v2, p0, Lnbisdk/hp;->ca:Lcom/nbi/common/NBIContext;

    invoke-static {v2}, Lnbisdk/bd;->d(Lcom/nbi/common/NBIContext;)Lnbisdk/cj;

    move-result-object v2

    if-eqz v2, :cond_a

    invoke-interface {v2}, Lnbisdk/cj;->getMaxSatellites()I

    move-result v3

    invoke-virtual {v0, v3}, Lcom/nbi/location/Location;->setNumberOfSatellites(I)V

    or-int/lit8 v1, v1, 0x40

    :cond_a
    invoke-virtual {v0, v1}, Lcom/nbi/location/Location;->setValid(I)V

    if-eqz v2, :cond_2

    invoke-interface {v2, v0}, Lnbisdk/cj;->a(Lcom/nbi/location/Location;)V

    goto/16 :goto_1

    :cond_b
    invoke-virtual {p1}, Landroid/location/Location;->getLatitude()D

    move-result-wide v1

    invoke-virtual {p1}, Landroid/location/Location;->getLongitude()D

    move-result-wide v3

    cmpl-double v5, v1, v6

    if-eqz v5, :cond_c

    cmpl-double v5, v3, v6

    if-eqz v5, :cond_c

    const-wide v5, 0x4056800000000000L

    cmpl-double v5, v1, v5

    if-gtz v5, :cond_c

    const-wide v5, -0x3fa9800000000000L

    cmpg-double v1, v1, v5

    if-ltz v1, :cond_c

    const-wide v1, 0x4066800000000000L

    cmpl-double v1, v3, v1

    if-gtz v1, :cond_c

    const-wide v1, -0x3f99800000000000L

    cmpg-double v1, v3, v1

    if-gez v1, :cond_d

    :cond_c
    move v1, v8

    goto/16 :goto_2

    :cond_d
    move v1, v9

    goto/16 :goto_2

    :cond_e
    invoke-virtual {p1}, Landroid/location/Location;->getLatitude()D

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Lnbisdk/ra;->setLatitude(D)V

    invoke-virtual {p1}, Landroid/location/Location;->getLongitude()D

    move-result-wide v1

    invoke-virtual {v0, v1, v2}, Lnbisdk/ra;->setLongitude(D)V

    invoke-virtual {p1}, Landroid/location/Location;->hasAltitude()Z

    move-result v1

    if-eqz v1, :cond_f

    invoke-virtual {p1}, Landroid/location/Location;->getAltitude()D

    move-result-wide v1

    double-to-int v1, v1

    invoke-virtual {v0, v1}, Lnbisdk/ra;->bp(I)V

    :cond_f
    invoke-virtual {p1}, Landroid/location/Location;->hasBearing()Z

    move-result v1

    if-eqz v1, :cond_10

    invoke-virtual {p1}, Landroid/location/Location;->getBearing()F

    move-result v1

    float-to-int v1, v1

    int-to-double v1, v1

    invoke-virtual {v0, v1, v2}, Lnbisdk/ra;->setHeading(D)V

    :cond_10
    invoke-virtual {p1}, Landroid/location/Location;->hasSpeed()Z

    move-result v1

    if-eqz v1, :cond_11

    invoke-virtual {p1}, Landroid/location/Location;->getSpeed()F

    move-result v1

    float-to-double v1, v1

    invoke-virtual {v0, v1, v2}, Lnbisdk/ra;->f(D)V

    :cond_11
    invoke-virtual {p1}, Landroid/location/Location;->getTime()J

    move-result-wide v1

    cmp-long v1, v1, v10

    if-lez v1, :cond_12

    invoke-virtual {p1}, Landroid/location/Location;->getTime()J

    move-result-wide v1

    div-long/2addr v1, v12

    long-to-int v1, v1

    int-to-long v1, v1

    const-wide/32 v3, 0x12d53d80

    sub-long/2addr v1, v3

    invoke-virtual {v0, v1, v2}, Lnbisdk/ra;->setTime(J)V

    :cond_12
    invoke-virtual {p1}, Landroid/location/Location;->hasAccuracy()Z

    move-result v1

    if-eqz v1, :cond_3

    invoke-virtual {p1}, Landroid/location/Location;->getAccuracy()F

    move-result v1

    float-to-int v1, v1

    int-to-double v1, v1

    invoke-virtual {v0, v1, v2}, Lnbisdk/ra;->z(D)V

    goto/16 :goto_3
.end method

.method public final onProviderDisabled(Ljava/lang/String;)V
    .locals 1

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    if-eqz v0, :cond_0

    const-string v0, "gps"

    if-ne p1, v0, :cond_0

    invoke-virtual {p0}, Lnbisdk/hp;->bj()Z

    :cond_0
    return-void
.end method

.method public final onProviderEnabled(Ljava/lang/String;)V
    .locals 1

    iget-object v0, p0, Lnbisdk/hp;->el:Lcom/nbi/location/LocationListener;

    if-eqz v0, :cond_0

    invoke-direct {p0}, Lnbisdk/hp;->aU()Z

    :cond_0
    return-void
.end method

.method public final onStatusChanged(Ljava/lang/String;ILandroid/os/Bundle;)V
    .locals 0

    return-void
.end method
